﻿Public Class UCFolderSelect

    Public Sub New()
        InitializeComponent()
        txtFolder.Text = FolderBrowserDialog1.SelectedPath
    End Sub

    Public Event Changed()

    Public Property SelectedFolder As String
        Get
            Return txtFolder.Text
        End Get
        Set(value As String)
            txtFolder.Text = value
            FolderBrowserDialog1.SelectedPath = value
        End Set
    End Property

    Private Sub btnBrowse_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowse.Click
        If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
            txtFolder.Text = FolderBrowserDialog1.SelectedPath
            RaiseEvent Changed()
        End If
    End Sub
    Private Sub txtFolder_TextChanged(sender As Object, e As System.EventArgs) Handles txtFolder.TextChanged
        RaiseEvent Changed()
    End Sub
End Class
